package com.car.dao.impl;

<<<<<<< HEAD
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.car.dao.DaoInterface;
import com.car.entity.Car_insu;
import com.car.util.JdbcUtil;

public class Car_insuDaoImpl implements DaoInterface<Car_insu>{

	@Override
	public int insert(Car_insu t) throws SQLException {
		String sql ="insert customer car_insu values(?,?,?,?,?,?,?)";
		int update = JdbcUtil.run.update(sql, t.getBno(),t.getCarid(),t.getBname(),t.getCnumber(),
							t.getBdate(),t.getBtime(),t.getBmoney());
		return update;
	}

	@Override
	public int delete(int id) throws SQLException {
		// TODO Auto-generated method stub
		String sql ="delete from car_insu where bno=?";
		int delete = JdbcUtil.run.update(sql);
		
		return delete;
	}

	@Override
	public int update(Car_insu t) throws SQLException {
		// TODO Auto-generated method stub
		String sql ="update car_insu set carid=?,bname=?,cnumber=?,bdate=?,btime=?,bmoney=?"
					+ "where bno=?";
		
		int update = JdbcUtil.run.update(sql,t.getCarid(),t.getBname(),t.getCnumber(),t.getBdate(),
							t.getBtime(),t.getBmoney(),t.getBno());
		
		return update;
	}

	@Override
	public List<Car_insu> queryAll() throws SQLException {
		// TODO Auto-generated method stub
		String sql ="select * from car_insu";
		List<Car_insu> list = JdbcUtil.run.query(sql, new BeanListHandler<Car_insu>(Car_insu.class));
		return list;
	}


	//主键为varchar
	public Car_insu queryById(int id) throws SQLException {
		// TODO Auto-generated method stub
		String sql="select * from car_insu where bno=?";
		Car_insu query = JdbcUtil.run.query(sql,new BeanHandler<Car_insu>(Car_insu.class),id);
		return query;
=======
import java.util.List;

import com.car.dao.DaoInterface;
import com.car.entity.Car_insu;

public class Car_insuDaoImpl implements DaoInterface<Car_insu>{

	@Override
	public int insert(Car_insu t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(int id) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int update(Car_insu t) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<Car_insu> queryAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Car_insu queryById(int id) {
		// TODO Auto-generated method stub
		return null;
>>>>>>> branch 'master' of https://gitee.com/kangdg/car.git
	}
	
	

}
